/* GUI CONVERTED from rewcrp01.p (converter v1.75) Thu Oct  5 12:01:07 2000 */
/* rewcrp01.p - WORK CENTER EFFICIENCY REPORT REPETITIVE                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                   */
/* All rights reserved worldwide.  This is an unpublished work.          */
/*F0PN*/ /*V8:ConvertMode=FullGUIReport                                  */
/* REVISION: 5.0    LAST MODIFIED: 06/01/89    BY: emb                   */
/* REVISION: 7.3    LAST MODIFIED: 04/27/93    BY: dzs  *GA37*           */
/* REVISION: 7.3    LAST MODIFIED: 12/23/94    BY: cpp  *FT95*           */
/* REVISION: 8.6    LAST MODIFIED: 10/13/97    BY: GYK  *K0Z4*           */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98  BY: *L007* A. Rahane        */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98  BY: *J314* Alfred Tan       */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00  BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00  BY: *N0KP* myb              */
/* REVISION: 9.1    LAST MODIFIED: 09/11/00  BY: *N0RQ* BalbeerS Rajput  */

/*K0Z4*/ /* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*K0Z4*/ {mfdtitle.i "b+ "} /*GA37*/

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rewcrp01_p_1 "Setup Eff"
/* MaxLen: Comment: */

&SCOPED-DEFINE rewcrp01_p_2 "Variance"
/* MaxLen: Comment: */

&SCOPED-DEFINE rewcrp01_p_6 "Efficiency"
/* MaxLen: Comment: */

/*N0RQ*
 * &SCOPED-DEFINE rewcrp01_p_3 "Work Ctr:"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp01_p_4 "Work Ctr Total: "
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp01_p_5 "Machine:"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp01_p_7 "  Report Total: "
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rewcrp01_p_8 " Machine Total: "
 * /* MaxLen: Comment: */
 *N0RQ*/

/* ********** End Translatable Strings Definitions ********* */

         define variable emp       like op_emp.
         define variable emp1      like op_emp.
         define variable wkctr     like op_wkctr.
         define variable wkctr1    like op_wkctr.
         define variable mch       like op_mch.
         define variable mch1      like op_mch.
         define variable part      like op_part.
         define variable part1     like op_part.
         define variable opdate    like op_date.
         define variable opdate1   like op_date.
         define variable run_var   like op_act_run column-label {&rewcrp01_p_2}.
         define variable run_eff   as decimal format "->>>9.99%"
                                   column-label {&rewcrp01_p_6}.
         define variable setup_var like wr_setup format "->>9.999".
         define variable setup_eff as decimal format "->>>9.99%"
                                   column-label {&rewcrp01_p_1}.
         define variable desc1     like pt_desc1.
         define variable std_run   like op_std_run format "->,>>9.999".
         define variable setup_per like wr_setup.
         define variable s_num     as character extent 7 format "x(9)".
         define variable d_num     as decimal decimals 9 extent 7.

         define variable i as integer.
         define variable j as integer.
         define variable multiple like mfc_logical.

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
wkctr    colon 20    wkctr1  label {t001.i} colon 49
            mch      colon 20    mch1    label {t001.i} colon 49
            opdate   colon 20    opdate1 label {t001.i} colon 49
            part     colon 20    part1   label {t001.i} colon 49
          SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

/*K0Z4*/ {wbrp01.i}

         
/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

            if wkctr1 = hi_char then wkctr1 = "".
            if mch1 = hi_char then mch1 = "".
            if part1 = hi_char then part1 = "".
            if opdate = low_date then opdate  = ?.
            if opdate1 = hi_date then opdate1 = ?.

/*K0Z4*/    if c-application-mode <> 'web' then
            
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K0Z4*/    {wbrp06.i &command = update
                      &fields = "  wkctr wkctr1 mch mch1 opdate opdate1
                                   part part1"
                      &frm = "a"}

/*K0Z4*/    if (c-application-mode <> 'web') or
/*K0Z4*/       (c-application-mode = 'web' and
/*K0Z4*/       (c-web-request begins 'data'))
            then do:

               bcdparm = "".
               {mfquoter.i wkctr  }
               {mfquoter.i wkctr1 }
               {mfquoter.i mch    }
               {mfquoter.i mch1   }
               {mfquoter.i opdate }
               {mfquoter.i opdate1}
               {mfquoter.i part   }
               {mfquoter.i part1  }

               if wkctr1 = "" then wkctr1 = hi_char.
               if mch1 = "" then mch1 = hi_char.
               if part1 = "" then part1 = hi_char.
               if opdate = ?  then opdate  = low_date.
               if opdate1 = ? then opdate1 = hi_date.

/*K0Z4*/    end.

            /* SELECT PRINTER */
            
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



            {mfphead.i}

            for each op_hist where (op_wkctr >= wkctr and op_wkctr <= wkctr1)
            and (op_mch >= mch and op_mch <= mch1)
            and (op_date >= opdate and op_date <= opdate1)
            and (op_part >= part and op_part <= part1)
            and op_type = "LABOR"
/*GA37*     and op_act_run <> 0  */
/*GA37*     and (op_act_setup <> 0 or op_act_run <> 0) */
            no-lock break by op_wkctr by op_mch by op_date
            with frame b width 132 no-attr-space:

               /* SET EXTERNAL LABELS */
               setFrameLabels(frame b:handle).

               if op_wkctr = "" then next.

/*K0Z4*        view frame phead. */

               std_run = op_std_run * op_qty_comp.
               run_var = std_run - op_act_run.
               run_eff = (std_run / op_act_run) * 100.

               if op_std_run = 0 then run_eff = 0.
               if run_eff = ? then run_eff = 100.

               accumulate std_run (total by op_wkctr by op_mch).
               accumulate op_act_run (total by op_wkctr by op_mch).

               if first-of(op_mch) then do with frame b:

                  if first-of (op_wkctr) then
                     multiple = no.
                  else
                     multiple = yes.

                  if page-size - line-counter < 3 then page.

                  display
/*N0RQ*              {&rewcrp01_p_3} @ op_date  */
/*N0RQ*/             getTermLabel("WORK_CENTER",8) + ":" @ op_date
                     op_wkctr @ op_shift format "x(8)" WITH STREAM-IO /*GUI*/ .
                  if op_mch > "" then display
/*N0RQ*              {&rewcrp01_p_5} @ op_emp  */
/*N0RQ*/             getTermLabel("MACHINE",7) + ":" @ op_emp
                     op_mch @ op_part WITH STREAM-IO /*GUI*/ .

                  find wc_mstr where wc_wkctr = op_wkctr and wc_mch = op_mch
                  no-lock no-error.
                  if available wc_mstr then do with frame b:
                     if op_mch > "" then down 1.
                     display wc_desc @ op_part WITH STREAM-IO /*GUI*/ .
                  end.

                  down 2.

               end.

               display
                  op_date
                  op_shift
                  op_emp
                  op_part
                  op_wo_op
                  op_qty_comp
                  std_run
                  op_act_run
                  run_var column-label {&rewcrp01_p_2}
                  run_eff
/*FT95*           space(3) op_trnbr. */
/*FT95*/          space(3) op_trnbr format ">>>>>>>9" WITH STREAM-IO /*GUI*/ .

               if last-of(op_mch)
               and (not last-of(op_wkctr) or multiple = yes)
               then do with frame b:

                  if page-size - line-counter < 2 then page.
                  else do:

                     down 1.
/*GA37*/             underline
                        std_run
                        op_act_run
                        run_var column-label {&rewcrp01_p_2}
                        run_eff.

/*GA37*              display "----------" @ std_run
 *                           "---------"  @ op_act_run
 *                           "---------"  @ run_var column-label "Variance"
 *                           "----------" @ run_eff.    */
                  end.

                  down 1.

                  display
/*N0RQ*              {&rewcrp01_p_8} @ op_qty_comp*/
/*N0RQ*/             getTermLabelRt("MACHINE_TOTAL",13) + ": " @ op_qty_comp
                     accum total by op_mch std_run @ std_run
                     accum total by op_mch op_act_run @ op_act_run
                     (accum total by op_mch std_run) -
                     (accum total by op_mch op_act_run)
                     @ run_var column-label {&rewcrp01_p_2}
                     ((accum total by op_mch std_run)
                         /  (accum total by op_mch op_act_run)) * 100
                     @ run_eff WITH STREAM-IO /*GUI*/ .

               end.

               if last-of(op_wkctr) then do with frame b:

                  if page-size - line-counter < 2 then page.
                  else do:
                     down 1.
/*GA37*/             underline
                        std_run
                        op_act_run
                        run_var column-label {&rewcrp01_p_2} run_eff.

/*GA37*              display "----------" @ std_run
 *                           "---------"  @ op_act_run
 *                           "---------"  @ run_var column-label "Variance"
 *                           "----------" @ run_eff.    */
                  end.

                  down 1.

                  display
/*N0RQ*             {&rewcrp01_p_4} @ op_qty_comp*/
/*N0RQ*/            getTermLabel("WORK_CENTER_TOTAL",14) + ": " @ op_qty_comp
                    accum total by op_wkctr std_run @ std_run
                    accum total by op_wkctr op_act_run @ op_act_run
                    (accum total by op_wkctr std_run) -
                    (accum total by op_wkctr op_act_run)
                    @ run_var column-label {&rewcrp01_p_2}
                    ((accum total by op_wkctr std_run)
                    /  (accum total by op_wkctr op_act_run)) * 100 @ run_eff WITH STREAM-IO /*GUI*/ .

               end.

               if last (op_wkctr) then do with frame b:

                  if page-size - line-counter < 2 then do with frame b:
                     page.
                     down 1.
                  end.
                  else down 2.

                  display
/*N0RQ*              {&rewcrp01_p_7} @ op_qty_comp*/
/*N0RQ*/             getTermLabelRt("REPORT_TOTAL",14) + ": " @ op_qty_comp
                     accum total std_run @ std_run
                     accum total op_act_run @ op_act_run
                     (accum total std_run) - (accum total op_act_run)
                     @ run_var column-label {&rewcrp01_p_2}
                     ((accum total std_run) /  (accum total op_act_run)) * 100
                     @ run_eff WITH STREAM-IO /*GUI*/ .

               end.

               
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/


            end.

            /* REPORT TRAILER */
            
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


         end.

/*K0Z4*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" wkctr wkctr1 mch mch1 opdate opdate1 part part1 "} /*Drive the Report*/
